import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../style/app_colors.dart';
import '../controllers/home_controller.dart';

class HomeView extends GetView<HomeController> {
  const HomeView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body:  Obx(()=> IndexedStack( /// 在这里修改
        index: controller.currentTabIndex.value,
        children: controller.pages,
      )),
      bottomNavigationBar: Obx(()=>
              Container(
                 decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(50.w),
                      color: AppColors.app_base_bgcolor_color,
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black.withOpacity(0.08), // 阴影颜色
                          spreadRadius: 10.w, // 阴影扩展半径
                          blurRadius: 7.w, // 阴影模糊半径
                          offset: Offset(0, 3), // 阴影偏移量（水平，垂直）
                        ),
                      ]
                ),
                child: ClipRRect(
                borderRadius: BorderRadius.only(topRight: Radius.circular(50.w),topLeft: Radius.circular(50.w)),
                child: BottomNavigationBar(
                  elevation: 100,
                  items: [
                    BottomNavigationBarItem(
                        icon: Image.asset('assets/images/home_unfocus.webp',width: 50.w,height: 50.h),
                        activeIcon: Image.asset('assets/images/home_focus.webp',width: 50.w,height: 50.h),
                        label: '首页',
                        backgroundColor:Colors.white
                    ),
                    BottomNavigationBarItem(
                        icon: Image.asset('assets/images/growup_unfocus.webp',width: 50.w,height: 50.h),
                        activeIcon: Image.asset('assets/images/growup_focus.webp',width: 50.w,height: 50.h),
                        label: '成长',
                        backgroundColor:Colors.white
                    ),
                    BottomNavigationBarItem(
                        icon: Image.asset('assets/images/my_unfocus.webp',width: 50.w,height: 50.h),
                        activeIcon: Image.asset('assets/images/my_focus.webp',width: 50.w,height: 50.h),
                        label: '我的',
                        backgroundColor:Colors.white
                    ),
                  ],
                  onTap: (index) {
                    controller.onTap(index);
                  },
                  currentIndex: controller.currentTabIndex.value,
                ),
                )
              )

        )
    );
  }
}
